//
//  NewCell.m
//  COJoke
//
//  Created by 陈渊佑 on 14/12/16.
//  Copyright (c) 2014年 carlosk. All rights reserved.
//

#import "NewCell.h"
#import "NewModel.h"
#import "UIImageView+WebCache.h"

@interface NewCell()
@property(nonatomic,strong)IBOutlet UILabel *titleL;
@property(nonatomic,strong)IBOutlet UILabel *descL;
@property(nonatomic,strong)IBOutlet UIImageView *iconIV;

@end

@implementation NewCell


//创建的时候被调用
-(void)createViews{
    [super createViews];
}
-(void)createData{
    [super createData];
}
//点击了某个按钮
-(BOOL)onClick:(UIView *)sender{
    return NO;
}
//Cell的高度 子类必须要实现。Cell的高度要在cell类里调整
+(NSNumber * )getCellHeight:(id)item withIndexPath:(NSIndexPath *)indexPath{
    return @63.f;
}
//section底部的高度
+(NSNumber * )heightForFooterInSection:(id)items withSection:(NSInteger)section{
    return @0.f;
}
//setion的头部的高度
+(NSNumber * )heightForHeaderInSection:(id)items withSection:(NSInteger)section{
    return @0.f;
}
//默认是屏幕的宽度
+(float )getCellWidth{
    return kFBaseWidth;
}

- (void)fillData:(NewModel *)item withIndexPath:(NSIndexPath *)indexPath{
    [super fillData:item withIndexPath:indexPath];
    self.titleL.text = item.title;
    self.descL.text = item.content;
    // 有图片和没有图片要重新整理
    NSLog(@"imageUrl = %@",item.imageUrl);
    [self.iconIV sd_setImageWithURL:[NSURL URLWithString:item.imageUrl] placeholderImage:nil];
    self.iconIV.hidden =[NSString isStringEmpty:item.imageUrl];
    int right = self.iconIV.right;
    int x = self.iconIV.hidden?10:right + 5;
    self.titleL.x = x;
    self.descL.x = self.titleL.x;
    self.titleL.width = kFBaseWidth - self.titleL.x - 30;
    self.descL.width = self.titleL.width;
}


@end
